﻿namespace EntityStore
{
    /// <summary>
    /// 控件包装参数
    /// </summary>
    public class Class
    {
        /// <summary>
        /// 元素是否垂直排列 flex-column
        /// </summary>
        public bool? IsVertical { get; set; }
        /// <summary>
        /// 元素是否垂直排列 flex-column
        /// </summary>
        public bool? IsContainer { get; set; }
        public SelfVerticalAlignment? SelfVerticalAlignment { get; set; }
        public ItemVerticalAlignment? ItemVerticalAlignment { get; set; }
        /// <summary>
        /// 表示容器中每一列的间隙,推荐0-5,可能被后面的GutterX和GutterY取代
        /// </summary>
        public int? Gutter { get; set; }
        /// <summary>
        /// 表示容器中每一列的间隙,推荐0-5
        /// </summary>
        public int? GutterX { get; set; }
        /// <summary>
        /// 表示容器中每一列的间隙,推荐0-5
        /// </summary>
        public int? GutterY { get; set; }
        /// <summary>
        /// 暂用容器多少列
        /// </summary>
        public int? ColCount { get; set; }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            string res = "";
            if (ItemVerticalAlignment.HasValue)
            {
                res += $" {ItemVerticalAlignment}";
            }
            if (SelfVerticalAlignment.HasValue)
            {
                res += $" {SelfVerticalAlignment}";
            }
            if (Gutter.HasValue)
            {
                res += $" g-{Gutter}";
            }
            if (GutterX.HasValue)
            {
                res += $" gx-{GutterX}";
            }
            if (GutterY.HasValue)
            {
                res += $" gy-{GutterY}";
            }
            if (ColCount.HasValue)
            {
                res += $" col-{ColCount}";
            }
            if (IsContainer.HasValue)
            {
                if (IsContainer.Value == true)
                {
                    res += $" row";
                }
            }
            if (IsVertical.HasValue)
            {
                if (IsVertical.Value == true)
                {
                    res += $" flex-column";
                }
            }
            return res.Replace("_", "-");
        }
    }
}
